package conceptmaniax.hotelapp.activities;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

public class NonSwipeableViewPager extends ViewPager {
	private View view;
	private Button bt1;
	private Button bt2;
	private Button bt3;

    public NonSwipeableViewPager(Context context) {
        super(context);
    }

    public NonSwipeableViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
    	if (this.view.getVisibility() == View.VISIBLE) {
		    Animation a = AnimationUtils.loadAnimation(getContext(), R.anim.disappear);
		    a.reset();
		    this.view.clearAnimation();
		    this.view.startAnimation(a);
		    this.view.setVisibility(View.INVISIBLE);    		
		    this.bt1.setSelected(false);
    		this.bt2.setSelected(false);
    		this.bt3.setSelected(false);
    	}
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return false;
    }
    
    public void getView (View v, Button b1, Button b2, Button b3) {
    	this.view = v;
    	this.bt1 = b1;
    	this.bt2 = b2;
    	this.bt3 = b3;
    }
}